package cn.csc.module.pay.dal.mysql.drawcash;

import java.util.*;

import cn.csc.framework.common.pojo.PageResult;
import cn.csc.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csc.framework.mybatis.core.mapper.BaseMapperX;
import cn.csc.module.pay.dal.dataobject.drawcash.PayDrawCashDO;
import org.apache.ibatis.annotations.Mapper;
import cn.csc.module.pay.controller.admin.drawcash.vo.*;

/**
 * 提款申请记录 Mapper
 *
 * @author liuchuang
 */
@Mapper
public interface PayDrawCashMapper extends BaseMapperX<PayDrawCashDO> {

    default PageResult<PayDrawCashDO> selectPage(PayDrawCashPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PayDrawCashDO>()
                .eqIfPresent(PayDrawCashDO::getSerialNo, reqVO.getSerialNo())
                .betweenIfPresent(PayDrawCashDO::getPayDate, reqVO.getPayDate())
                .eqIfPresent(PayDrawCashDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(PayDrawCashDO::getDrawType, reqVO.getDrawType())
                .eqIfPresent(PayDrawCashDO::getAmount, reqVO.getAmount())
                .eqIfPresent(PayDrawCashDO::getBody, reqVO.getBody())
                .eqIfPresent(PayDrawCashDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PayDrawCashDO::getHandFee, reqVO.getHandFee())
                .eqIfPresent(PayDrawCashDO::getDrawMsg, reqVO.getDrawMsg())
                .eqIfPresent(PayDrawCashDO::getTaskStatus, reqVO.getTaskStatus())
                .eqIfPresent(PayDrawCashDO::getTaskTime, reqVO.getTaskTime())
                .betweenIfPresent(PayDrawCashDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PayDrawCashDO::getId));
    }

    default List<PayDrawCashDO> selectList(PayDrawCashExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PayDrawCashDO>()
                .eqIfPresent(PayDrawCashDO::getSerialNo, reqVO.getSerialNo())
                .betweenIfPresent(PayDrawCashDO::getPayDate, reqVO.getPayDate())
                .eqIfPresent(PayDrawCashDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(PayDrawCashDO::getDrawType, reqVO.getDrawType())
                .eqIfPresent(PayDrawCashDO::getAmount, reqVO.getAmount())
                .eqIfPresent(PayDrawCashDO::getBody, reqVO.getBody())
                .eqIfPresent(PayDrawCashDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PayDrawCashDO::getHandFee, reqVO.getHandFee())
                .eqIfPresent(PayDrawCashDO::getDrawMsg, reqVO.getDrawMsg())
                .betweenIfPresent(PayDrawCashDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PayDrawCashDO::getId));
    }

}
